<html lang="en">
  <head>
    <title>Welcome to IdTokenService</title>
    <STYLE TYPE="text/css">
	<!--
	  input {font-family:verdana, arial, helvetica, sans-serif;font-size:20px;line-height:40px;}
	  div.padded {  
         padding-left: 5em;  
      } 
	-->
    </STYLE>
    <meta name="google-signin-scope" content="profile email">
    <meta name="google-signin-client_id" content="${client_id}">
    <script src="https://apis.google.com/js/platform.js" async defer></script>
  </head>
  <body>
    <script>
      function onSignIn(googleUser) {
        var id_token = googleUser.getAuthResponse().id_token;
        var xhr = new XMLHttpRequest();
        xhr.onload = function() {
            var parser = new DOMParser();
            var dom = parser.parseFromString(xhr.responseText, "text/xml");
            var userName = dom.getElementsByTagName("name")[0].childNodes[0].nodeValue;
            document.getElementById("submitButton").disabled = false;
            document.getElementById("welcome").childNodes[0].nodeValue = userName + ", ";
        }
        xhr.open('POST', 'https://localhost:8080/user/service/oidc/rp/signin');
        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        xhr.send('idtoken=' + id_token);
      };
    </script>
    
    <div class="padded">
    <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
    <p/>
    <div id="welcome">&nbsp;</div>
<h2>Welcome to IdToken Service</h2>
<em/>
<p/>
     <form action="https://localhost:8080/user/service/info/token" method="POST">
         <input type="submit" id="submitButton" disabled="true" value="Display IdToken Properties"/>
     </form>
</div>
  </body>
</html>